package com.class05.controller;

import com.class05.pojo.Pet;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class PetController {

    private final Pet pet;

    public PetController(Pet pet) {
        this.pet = pet;
    }

    @GetMapping("/pet/speak")
    public String speak() {
        pet.speak();
        return "The pet said: " + pet.getClass().getSimpleName();
    }
}